package com.demo.road.controller;

import com.demo.road.common.Result;
import com.demo.road.service.FeeService;
import com.demo.road.service.OperatorService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;


@RestController
@RequestMapping("fee")
public class FeeController {
    /**
     * 服务对象
     */
    @Resource
    private FeeService service;
    @RequestMapping("getPageList")
    @ResponseBody
    public Result getPageList(@RequestBody Map param){
        int pageNum = (int) param.get("page");
        int limitNum = (int) param.get("limit");
        pageNum = (pageNum-1) * limitNum ;

        param.put("page", pageNum);
        param.put("limit", limitNum);
        System.out.println(param);
        Map<String, Object> pageList = service.getPageList(param);
        return Result.ok().Data(pageList);
    }

    @RequestMapping("getPageList2")
    @ResponseBody
    public Result getPageList2(@RequestBody Map param){
        int pageNum = (int) param.get("page");
        int limitNum = (int) param.get("limit");
        pageNum = (pageNum-1) * limitNum ;

        param.put("page", pageNum);
        param.put("limit", limitNum);
        System.out.println(param);
        Map<String, Object> pageList = service.getPageList2(param);
        return Result.ok().Data(pageList);
    }

    @RequestMapping("/saveItem")
    @ResponseBody
    public Result saveItem(@RequestBody Map param){
        service.saveItem(param);
        return Result.ok();
    }
    @RequestMapping("/deleteItemsByIds")
    @ResponseBody
    public Result deleteItemsByIds(@RequestBody Map param){
        service.deleteItemsByParam(param);
        return Result.ok();
    }
    @RequestMapping("/checkBlackList")
    @ResponseBody
    public Result checkBlackList(@RequestParam("serial")String serial){
       Map data= service.checkBlackList(serial);
        return Result.ok().Data(data);
    }


}

